CREATE TABLE MARA (
    MATNR VARCHAR(18) NOT NULL,
    ERSDA DATE,
    ERNAM VARCHAR(12),
    AENAM VARCHAR(12),
    AEDAT DATE,
    LAEDA DATE,
    LVORM CHAR(1),
    PRDHA CHAR(2),
    STPRS DECIMAL(13, 2),
    PEINH DECIMAL(13, 3),
    BWTAR CHAR(4),
    MEINS CHAR(3),
    BSPGE DECIMAL(13, 2),
    BKLAS CHAR(9),
    SERNP CHAR(10),
    SOBSL CHAR(1),
    SPART CHAR(2),
    MBRSH CHAR(2),
    MTPOS_MARA INTEGER,
    PRIMARY KEY (MATNR)
);

CREATE TABLE VBAP (
    VBELN VARCHAR(10) NOT NULL,
    POSNR VARCHAR(6) NOT NULL,
    MATNR VARCHAR(18) NOT NULL,
    KDMAT VARCHAR(18),
    VRKME CHAR(3),
    LFIMG DECIMAL(13, 3),
    WMENG DECIMAL(13, 3),
    VRKMG DECIMAL(13, 3),
    NETWR DECIMAL(15, 2),
    WAERK CHAR(5),
    KZWI1 DECIMAL(13, 2),
    KZWI2 DECIMAL(13, 2),
    KZWI3 DECIMAL(13, 2),
    KZWI4 DECIMAL(13, 2),
    KZWI5 DECIMAL(13, 2),
    FKIMG DECIMAL(13, 3),
    NTGEW DECIMAL(13, 3),
    BRGEW DECIMAL(13, 3),
    GEWEI CHAR(3),
    VOLUM DECIMAL(13, 3),
    PRIMARY KEY (VBELN, POSNR),
    FOREIGN KEY (MATNR) REFERENCES MARA(MATNR)
);
